package com.zyh.em.update;

import com.zyh.em.entity.HistoryData;
import com.zyh.em.entity.LoginSuccessData;

import java.util.HashSet;
import java.util.Set;

public class OrdernessPasswordUpdate extends AbstractUpdate{
    @Override
    public void update(LoginSuccessData loginSuccessData, HistoryData historyData, UpdateChain updateChain) {
        Set<String> set = historyData.getOrdernessPasswords();
        if(set==null){
            set = new HashSet<>();
            historyData.setOrdernessPasswords(set);
        }
        set.add(loginSuccessData.getOrdernessPassword());
        
        updateChain.doUpdate(loginSuccessData, historyData);
    }
}